/*
 * File: exercise5.cpp
 * -------------------
 * This program finds the largest integer in a list.
 * compile command :
 * g++ -Wall -g exercise5.cpp -o exercise5 -lStanfordCPPLib -I ../include/
 */

#include <iostream>
#include "simpio.h"
using namespace std;
const int SENTINEL = 0;

int main()
{
	int large ;
	int i;
	cout<<"This program finds the largest integer in a list."<<endl;
	cout<<"Enter "<<SENTINEL<<" to signal the end of the list."<<endl;
	i = getInteger("? ");
	large = i;
	if(i == SENTINEL)
	{
		cout<<"You just enter: "<<SENTINEL<<endl;
		return 0;
	}

	while((i = getInteger("? ")) != SENTINEL)
	{
		if(i > large)
			large = i;
	}
	cout<<"The largest value was "<<large<<endl;
	return 0;
}
